﻿<link href="@Url.Content("~/content/activitie_detail.css")" rel="stylesheet" type="text/css" />

@model IEnumerable<PessModel.Contract>
@{
    ViewBag.Title = "Index";
}

<div id="m-title">
    <h2>协议库</h2>
</div>

<input type="file" name="file_upload" id="file_upload" />
<div>
        @{
            var grid = new WebGrid(Model, defaultSort: "Title");
        }
        @grid.GetHtml(columns: from c in grid.Columns(
                 grid.Column("Title", header: " 文件名 ", style: "thAction thAction2",format: @<text>@Html.ActionLink((string)item.Title, "Download", "Contract", new { contractID = (int)item.ID }, null)</text>),
                 grid.Column("FileSize", header: " 文件大小（KB） "),
                 grid.Column("TimeStamp", header: " 最后修改时间 "),
                 grid.Column("Operation", header: "操作",style:"thAction thAction3", format: @<text>@Html.ActionLink("删除", "Delete", "Contract", new {contractID = item.ID }, null)
                                                                            @Html.ActionLink("专家表", "Experts", "Contract", new {ContractID = item.ID }, null)</text>)
             )
                where !c.ColumnName.Contains("Operation") || (Roles.IsUserInRole("Admin") )
                select c
        )
        </div>

@section Styles{
    <link href="@Href("~/Content/uploadify.css")" rel="stylesheet" />
}

@section JavaScript{
    <script src="@Href("~/Scripts/jquery.uploadify.js")" type="text/javascript"></script>
    <script type="text/javascript">
        //var archiveID=@*@Model.ID*@
        $(function () {
            $('#file_upload').uploadify({
                'fileSizeLimit':0,
                'swf': '@Url.Content("~/Scripts/uploadify.swf")',
                'uploader': '@Url.Content("~/Contract/Upload")',
                'auto': true,
                'fileSizeLimit': 0,
                'multi': true,
                //'formData': {'archiveID':archiveID},
                'buttonText': '上传协议',
                'cancelImg': '@Url.Content("~/images/uploadify-cancel.png")',
                'onQueueComplete' : function(file, data, response) {
                    //alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
                    location.reload(true);
                }
            });
            //setDivHeight();
        });
    </script>
    }
